package com.imooc.diners.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.imooc.commons.model.domain.ResultInfo;
import com.imooc.commons.utils.ResultInfoUtil;
import com.imooc.diners.service.SendVerifyCodeService;

/**
 * \* @author: bear
 * \* Date: 2021-07-11-19:00
 * \* describe:
 */
@RestController
public class SendVerifyCodeController {

	@Resource
	private SendVerifyCodeService sendVerifyCodeService;

	@Resource
	private HttpServletRequest request;

	/**
	 * 发送验证码
	 *
	 * @param phone
	 * @return
	 */
	@GetMapping("send")
	public ResultInfo send(String phone) {
		sendVerifyCodeService.send(phone);
		return ResultInfoUtil.buildSuccess("发送成功", request.getServletPath());
	}
}
